<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 希望监听用户触发屏幕则直接给window对象绑定触摸事件
      window.ontouchstart = function (e) {
        console.log('ontouchstart', '手指触摸到屏幕', e)
      }
      window.ontouchmove = function (e) {
        console.log('ontouchmove', '手指在屏幕上移动', e)
      }
      window.ontouchend = function (e) {
        console.log('ontouchend', '手指离开屏幕', e)
      }
      window.ontouchcancel = function (e) {
        console.log('ontouchcancel', '触摸被中断', e)
      }

      // 如果希望监听用户触发屏幕上的某个盒子(元素),则直接给这个元素的dom对象绑定触摸事件
    </script>
  </body>
</html>
